/*
 * Parser.h
 *
 *  Created on: 2010-4-28
 *      Author: Guobc
 */

#ifndef ABSTRACTPASER_H_
#define ABSTRACTPASER_H_

#include "Lexer.h"
#include "Parser.h"
using namespace std;

namespace HA {

class AbstractParser: public HA::Parser {

public:

	/**
	 * Construct method.
	 * @param lexer The lexer that can construct a token.
	 */
	AbstractParser(Lexer* lexer):
		mLexer(lexer), nodeFactory(){
	}
	/**
	 * Parse character stream.
	 */
	inline void parse() throw (ParserException){

	}

	/**
	 * Get root node after parsing.
	 * @return
	 */
	inline ASTNode* getRootNode() {
		return NULL;
	}

protected:

	/**
	 * Get node factory that crate AST node.
	 * @return Node factory.
	 */
	inline NodeFactory getNodeFactory() {
		return nodeFactory;
	}

//	/**
//	 * Get document.
//	 * @return
//	 */
//	inline ASTDom* getDocument() {
//		return mLexer == NULL ? NULL : mLexer->getDocument();
//	}

protected:
	Lexer* mLexer;
	NodeFactory nodeFactory;
};
}

#endif /* PASER_H_ */
